<template>
	<view class="container">
		<TopNav title="解约"></TopNav>
		<view class="bg-white radius p-lr16 p-t13 p-b12">
			<view class="">
				<text class="f-w600 f-s15 line-height22">解约理由</text>
			</view>
			<view class="m-t12">
				<u-textarea v-model="form.content" placeholder="请输入解约理由" count border="none" height="250rpx"
					placeholderClass="textarea-placeholder" maxlength="100" style="color:#202020;"></u-textarea>
			</view>
		</view>
		<view class="fixed-bottom bg-white p-lr16">
			<view class="self-btn full-width m-t6" hover-class="pressed" @click="handleSubmit">
				<text>解约</text>
			</view>
		</view>
		<Toast></Toast>
	</view>
</template>

<script>
	import {
		termination,terminationCheck
	} from "@/api/mine"
	export default {
		data() {
			return {
				form: {
					content: ''
				}
			}
		},
		onLoad(){
			this.terminationCheck()
		},
		methods: {
			terminationCheck(){
				terminationCheck().then(res=>{
					
				})
			},
			handleSubmit() {
				if (!this.form.content) {
					this.$toast('请填写解约理由')
					return
				}
				this.$modal.loading("正在提交")
				termination(this.form).then(res => {
					this.$modal.closeLoading()
					this.$toast('解约申请已提交')
				}).catch(() => this.$modal.closeLoading())
			}
		}
	}
</script>

<style scoped lang="scss">
	@import '@/common/css/var.scss';

	page {
		@include fixed-bottom;
	}

	.container {
		padding: 32rpx;
	}
</style>